import IButton from './IButton';
import IComboBox from './IComboBox';
import ISkinFactory from './ISkinFactory';
import SpringSkinFactory from './Spring/SkinFactory';
import SummerSkinFactory from './Summer/SkinFactory';
import separator from '../patternSeparator';

separator('抽象工厂模式');

let skin:ISkinFactory = getBeen('SpringSkinFactory');
let button:IButton = skin.createButton();
let comboBox:IComboBox = skin.createComboBox();

button.click();
comboBox.drop();

button.display();
comboBox.display();






function getBeen(className:string):ISkinFactory{
  let local = Function('return self')();
  local.SpringSkinFactory = SpringSkinFactory;
  local.SummerSkinFactory = SummerSkinFactory;
  return <ISkinFactory> eval.call(local, `new ${className}()`);
}